package work.shyk.cts.demo;

import com.atlassian.httpclient.api.Request;
import com.atlassian.jira.rest.client.AuthenticationHandler;

/**
 * description: <br>
 * createTime: 2020/12/18 14:12 <br>
 *
 * @author zzh
 */
public class CookieAuthenticationHandler implements AuthenticationHandler {
    private static ThreadLocal<String> tokenTrehadLocal = new ThreadLocal<>();


    public CookieAuthenticationHandler() {
    }


    @Override
    public void configure(Request request) {
        String token = tokenTrehadLocal.get();
        request.setHeader("Cookie", token);
    }

    public static void setToken(String token) {
        tokenTrehadLocal.set(token);
    }
}
